package aoi.retail_system.mapper;

import aoi.retail_system.model.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface OrderMapper extends BaseMapper<Order> {
    @Select("SELECT * FROM orders WHERE id = #{id}")
    Order selectById(Long id);
    @Insert("INSERT INTO orders (id, product_id, quantity, total_price, status, order_date) VALUES (#{id}, #{product_id}, #{quantity}, #{total_price}, #{status}, #{order_date})")
    int insert(Order order);
    @Update("UPDATE orders SET status = #{status} WHERE id = #{id}")
    int updateById(Order order);

}
